package net.pimpas.report.processor.tree.branch;

import java.util.ArrayList;
import java.util.List;

import net.pimpas.report.processor.tree.node.AbstractNode;
import net.pimpas.report.processor.tree.node.Node;

public class DefaultBranch extends AbstractNode implements Branch {
	private List<Node> nodes;
	
	public DefaultBranch(String propertyName, Class<?> propertyClass) {
		super(propertyName, propertyClass);
		this.setNodes(new ArrayList<Node>());
	}

	public List<Node> getNodes() {
		return nodes;
	}
	public void setNodes(List<Node> nodes) {
		this.nodes = nodes;
	}

	public void addNode(Node node) {
		this.getNodes().add(node);
		node.setParent(this);
	}

	public void removeNode(Node node) {
		this.getNodes().remove(node);
		node.setParent(null);
	}
}